home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / string / memchr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-05  |  379 b   |  26 lines

  1. #include <string.h>
  2.  
  3. /************************************************************************/
  4.  
  5. #undef memchr
  6.  
  7. void *memchr(const void *Memory, int c, size_t Size)
  8.  
  9. {
  10.   if (Size != 0)
  11.     {
  12.       do
  13.     {
  14.       unsigned char *t;
  15.  
  16.       t=(unsigned char *)Memory;
  17.       if (*t++==(unsigned char)c)
  18.         {
  19.           return --t;
  20.         }
  21.     }
  22.       while(--Size != 0);
  23.     }
  24.   return (void *)Size;
  25. }
  26.